<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my"  uri="http://www.trkj.com/tr1702/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考试试卷</title>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link id="theme" rel="stylesheet" type="text/css"  href="<c:url value="js/jquery-easyui-1.5.4.2/themes/ui-cupertino/easyui.css"/>"/>
<link  rel="stylesheet" type="text/css" href="<c:url value="js/jquery-easyui-1.5.4.2/themes/icon.css"/>"/>
<body>
<script type="text/javascript">
	$(function(){
		$(".kssj_insert").linkbutton({
			onClick:function(){
				$(".kssj_").panel({
					href:"kssj_insert"
					
				})
			}
		})
		<my:g id="147">$("#kssj_sousuo").datagrid({onDblClickRow:function(row){
			//找到选中的行
			var row = $("#kssj_sousuo").datagrid("getSelected");
			if(!row){
				$.messager.alert('提示', '没有选中要编辑的行！');
				return;
			}
				$(".kssj_").panel({
					href:"kssj_sjlr?epId="+row.epId
					
				})
			}

		});

		</my:g>
		
		$('#sjlr').linkbutton({
			onClick:function(){
				$("#sjlr1").dialog("open");
			}
		})
		
		$("#kssj_clear").linkbutton({onClick:function(){
			//找到选中的行
			var row = $("#kssj_sousuo").datagrid("getSelected");
			if(!row){
				$.messager.alert('提示', '没有选中要删除的行！');
				return;
			}
			
			$.messager.confirm('确认', '真的要删除吗？', function(v){
				$("<form method = 'post'>").appendTo(document.body).form({
					url:'kssj_delete',
					onSubmit:function(params){
						params["epId"] =row.epId;
					},success:function(v){
						v = eval("(" + v + ")");
						if(v.success){
							$.messager.alert('恭喜', '删除成功');
							$('#kssj_sousuo').datagrid('reload');
						}else{
							$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
						}
					}
				}).submit();

			});
		}});
	});
	
</script>
<style>
	.line{
		margin:5px 20px;
	}
</style>
<div class="easyui-panel kssj_" data-options="fit:true,border:false">
	<table id="kssj_sousuo" class="easyui-datagrid" style="text-align:center;" data-options="
		method:'post',
		fitColumns:true,
		fit:true,
		url:'to_kssj_findAll',
		nowrap:false,
		autoRowHeight:true,
		rownumbers:true,
		pagination:true,
		pageList:[5,10,15,20],
		pageSize:5,
		singleSelect:true,
		striped:true,
		toolbar:'#kssj'
	">
		<thead>
			<tr>
				<th data-options="field:'epId',align:'center',width:'10'">编号</th>
				<th data-options="field:'classSjName',align:'center',width:'20'">名称</th>
				<th data-options="field:'quName',align:'center',width:'10'">题库</th>
				<th data-options="field:'epWay',align:'center',width:'10'">方式</th>
				<th data-options="field:'epGrade',align:'center',width:'10'">等级</th>
				<th data-options="field:'epShichang',align:'center',width:'10'">时长</th>
				<th data-options="field:'epTotal',align:'center',width:'10'">总分</th>
				<th data-options="field:'epNumberQuestion',align:'center',width:'10'">题型数</th>
				<th data-options="field:'epNumberTotal',align:'center',width:'10'">总量数</th>
				<th data-options="field:'epTakeMeasure',align:'center',width:'10'">抽题数</th>
				<th data-options="field:'epHaveTest',align:'center',width:'10'">已考次数</th>
				<th data-options="field:'epState',align:'center',width:'10'">状态</th>
				<th data-options="field:'epDate',align:'center',width:'30',
				formatter:function(value,row,index){
					var date= new Date(value);
					return date.toLocaleString();
				}">创建日期</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
	
	<div id="kssj">
		<my:g id="145"><a href="#" class="easyui-linkbutton kssj_insert" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a>
		</my:g>
		<!-- 
		<a href="#" class="easyui-linkbutton" id="sjlr" data-options="iconCls:'icon-add',plain:true,text:'试卷录入'"></a> -->
		<my:g id="146"><a href="#" class="easyui-linkbutton" id="kssj_clear" data-options="iconCls:'icon-clear',plain:true,text:'删除'"></a></my:g>
		题库  <select class="easyui-combobox" data-options="width:100,height:25,panelHeight:'auto',editable:false">
				<c:forEach items="${list}" var="l">
					<option value="${l.quId}">${l.quName}</option>
				</c:forEach>
			</select>
		搜索文本  <input id="bir" class="easyui-searchbox" data-options="width:100,
		searcher:function(value,name){
				$('#kssj_sousuo').datagrid('load','wdkj_query?classSjName='+value);
			}">
		<a id="btn" class="easyui-linkbutton" data-options="width:60,plain:false,text:'搜索'"></a> 
	</div>
	
	<div class="easyui-dialog" id="sjlr1" data-options="width:550,height:400,title:'试卷信息',
				modal:true,
				closed:true,
				iframe:'kssj_sjlr',
				buttons:[{
					text:'确定',
					id:'sure',
					iconCls:'icon-ok',
					handler:function(){
						$('#sjlr_insert').form({
							url:'add_kssj_insert',
							onSubmit:function(insert){
								insert['examPaper.epId'] = $('#epId').textbox('getText');
								insert['examPaper.classSjName'] = $('#classSjName').textbox('getText');
								insert['examPaper.epTotal'] = $('#epTotal').textbox('getText');
								insert['examPaper.epShichang'] = $('#epShichang').textbox('getText');
								insert['examPaper.epGrade'] = $('#epGrade').val();
								insert['examPaper.epWay'] = $('#epWay').val();
							},success:function(v){
								$.messager.alert('提示','添加成功！');
								$('#sjlr1').dialog('close');
									
							}
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-clear',
					handler:function(){
						$('#sjlr1').dialog('close');			
					}
				}]">
				<form action="" method="post" id="sjlr_insert">
					<div class="line">
						<input class="easyui-textbox" id="epId" data-options="label:'*编号',width:350,height:25,labelWidth:130"/>
					</div>
					<div class="line">
						<input class="easyui-textbox" id="classSjName" data-options="label:'*名称',width:350,height:25,labelWidth:130"/>
					</div>
					<div class="line">
						<input class="easyui-textbox" id="epTotal" value="0" data-options="label:'合格线',width:350,height:25,labelWidth:130"/>
					</div>
					<div class="line">
						<input class="easyui-textbox" id="epShichang" data-options="label:'*时长',width:350,height:25,labelWidth:130"/>
					</div>
					
				<div class="line">
					<select id="epGrade" class="easyui-combobox" data-options="label:'等级',width:350,height:25,panelHeight:'auto',labelWidth:130,editable:false">
						<option>高级</option>
						<option>中级</option>
						<option>低级</option>
					</select>
				</div>
				<div class="line">
					<select id="epWay" id="epWay" class="easyui-combobox" data-options="label:'考试方式',width:350,height:25,panelHeight:'auto',labelWidth:130,editable:false">
						<option value="未开考">面试</option>
						<option value="笔试">笔试</option>
						<option value="机试">机试</option>
					</select>
				</div>
				</div>
				</form>
			</div>
</div>
</body>
</html>